package cn.net.lwj.sjqy.entity;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * 类的字段名必须和配置文件的名一致
 * prefix:小写
 * 必须有getter和setter方法才能注入成功
 *
 * 如果使用@PropertySource,貌似还是需要配合@ConfigurationProperties注解,否则取不到值
 */
@Component
//@ConfigurationProperties(prefix = "person")//小写  yml文件的配置
@ConfigurationProperties(prefix = "people")//小写  person.properties的配置
@PropertySource(value = {"classpath:person.properties"},encoding = "utf-8")//小写
@Data
//@Configuration
public class Person {
    private String id;
    private String name;
}
